package com.zy.serivice.impl;

import com.zy.bean.TMember;
import com.zy.mapper.TMemberMapper;
import com.zy.service.TMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TMemberServiceImpl implements TMemberService {
    @Autowired
    TMemberMapper tMemberMapper;
    @Override
    public int insert(TMember tMember) {
        String loginacct = tMember.getLoginacct();
        String userpswd = tMember.getUserpswd();
        TMember newmember = new TMember();
        newmember.setUsername(loginacct);
        String usertype = tMember.getUsertype();
        if(usertype.equals("个人")){
            newmember.setUsertype("0");
        }else {
            newmember.setUsertype("1");
        }

        newmember.setLoginacct(loginacct);
        newmember.setUserpswd(userpswd);
        newmember.setEmail(tMember.getEmail());
        newmember.setAuthstatus("0");
        int insert = tMemberMapper.insertSelective(newmember);
        return insert;
    }
}
